package com.ktjy.rabbitmqconsumer7003.utils;


import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class MqConsumer {

    /**
     * 监听简单队列信息
     *
     * @param msg
     */
    @RabbitListener(queuesToDeclare = @Queue("spring_simple_queue"))
    public void springSimpleQueueListener(String msg) {
        System.out.println("7003服务:springSimpleQueueListener 收到消息:" + msg);
    }

    @RabbitListener(queuesToDeclare = @Queue("spring_work_queue"), concurrency = "1")
    public void springWorkQueueListener(String msg) {
        System.out.println("7003服务:workQueueListener收到消息:" + msg + ",当前处理线程:"
                + Thread.currentThread().getName());
    }
}
